package com.xzh.rocketmq.service;




import com.mall.common.util.JsonResult;
import com.xzh.mallorderspi.model.Order;
import com.xzh.mallorderspi.model.OrderItem;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("order-api")
public interface OrderFeignService {
    @PostMapping("/api/orders")
    ResponseEntity<JsonResult<?>> save(@RequestBody Order order);

    //修改订单
    @PutMapping("/apiorders")
    ResponseEntity<JsonResult<?>> update(@RequestBody Order order);

    //根据主键查询，无缓存
    @GetMapping("/apiorders/id/{id}")
    ResponseEntity<JsonResult<Order>> findById(@PathVariable Integer id);

    //查询指定订单的所有订单项
    @GetMapping("/apiorder_items/order_id/{orderId}")
    ResponseEntity<JsonResult<List<OrderItem>>> findOrderItemsByOrderId(@PathVariable Integer orderId);
}
